import 'package:custompaint/page/preview/CustomAutoPainter.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import 'logic.dart';

class PreviewPage extends StatelessWidget {
  const PreviewPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final logic = Get.find<PreviewLogic>();
    final state = Get.find<PreviewLogic>().state;
    return Scaffold(
      appBar: AppBar(),
      body: Center(
        child: GestureDetector(
          onTap: () {
            state.isOpen.value = !state.isOpen.value;
          },
          child: Obx(() {
            return CustomPaint(
              size: const Size(77.31, 43.24),
              painter: MyCustomPainter(
                  frame: state.isOpen.value ? 'open' : 'close'), //桢名字
            );
          }),
        ),
      ),
    );
  }
}
